﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using IHISCETeim.Model;
using IHISCETeim.BLL;
using IHISCETeim.Library;
using FineUI;
using Newtonsoft.Json.Linq;
using Newtonsoft.Json;
using System.Data;

namespace IHISCETeim.Web.AgentSys.SvrMgr
{
    public partial class ReportNoNormative : AgentPageBase
    {
        protected override Permission[] PowerKey
        {
            get
            {
                return new Permission[] { Permission.查看 };
            }
        }
        protected override string DWZRef
        {
            get { return "ReportNoNormative"; }
        }

        private string GetSqlwhere()
        {
            string sql = "";
            if (this.FromDate.Text != "" || this.ToDate.Text != "")
            {
                sql += string.Format(" IssueDate between '{0}' and '{1}'", this.FromDate.Text, this.ToDate.Text);
            }
            return sql;


        }
        protected DataTable _dt = null;
        protected DataTable dt
        {
            get
            {
                if (_dt == null)
                {
                    _dt = AgentQltyController.GetNoNormativeReport(GetSqlwhere());
                }
                return _dt;
            }
        }

        protected string GetTableTbody()
        {
            string trRowString = "";
            //string trRow1String = "";// "<td>保内机器</td>";
            foreach (DataRow dr in dt.Rows)
            {
                trRowString += "<tr>";
                trRowString += string.Format("<td><a href='#' onclick='onAgentNameClick(\"{0}\",\"{1}\",\"{2}\")' >{0}</a></td>", dr["AgentName"], this.FromDate.Text, this.ToDate.Text);
                trRowString += string.Format("<td>{0}</td>", dr["allcount"]);
                trRowString += string.Format("<td>{0}</td>", dr["GL"]);
                trRowString += "</tr>";
            }
            return trRowString;
        }

        protected void btnSearch_Click(object sender, EventArgs e)
        {

        }
    }
}